/**
 * @(#)Producer.java, Nov 12, 2012. 
 * 
 * Copyright 2012 Yodao, Inc. All rights reserved.
 * YODAO PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.buaaer.producerconsumer;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

/**
 *
 * @author wangheng
 *
 */
public class Producer {
    
    public static void main(String[] args) throws Exception {
        
        for(int i = 0; i < 1000; i++) {
            Socket socket = new Socket("localhost", 10000);
            ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
            out.writeObject("hello world");
            
            ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
            System.out.println(in.readObject());
            
            out.close();
            in.close();
            socket.close();
        }


        
    }
    



}
